package com.sc.smartcommunity.service.impl;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.smartcommunity.domain.Activity;


import com.sc.smartcommunity.domain.Announcement;
import com.sc.smartcommunity.mapper.ActivityMapper;
import com.sc.smartcommunity.service.ActivityService;
import org.springframework.stereotype.Service;

@Service
public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> implements ActivityService {


    @Override
    public IPage<Activity> getPage(Page<Activity> page, String title) {
        QueryWrapper<Activity> queryWrapper = new QueryWrapper<>();

        // 标题模糊查询
        if (title != null && !title.isEmpty()) {
            queryWrapper.like("title", title);
        }

        // 按创建时间降序排序
        queryWrapper.orderByDesc("create_time");

        return baseMapper.selectPage(page, queryWrapper);
    }
}
